package ch09.shili;

import java.io.File;

public class S01 {

    public static void main(String[] args) {
        //绝对路径
//        File file = new File("D:\\test.txt");
        //相对路径
        File file = new File("test.txt");
        System.out.println("exists:"+file.exists());
        if(file.exists()){
            if(file.isFile()){
                System.out.println("此File是文件");
                System.out.println("文件长度:"+file.length()+"字节");
                System.out.println("文件名:"+file.getName());
                System.out.println("文件路径:"+file.getPath());
                System.out.println("绝对路径:"+file.getAbsolutePath());
            }else{
                System.out.println("此File是文件夹");
            }
        }else{
            System.out.println("此文件不存在");
        }
    }
}
